This demo shows how to use the RegisterGoToControl() method of IDBDataSource,
which is implemented by DBWebDataSource and EcoDataSource. The DBWebListBox
control is registered as a GoTo control in the Page_Load event. The DBWebListBox
is connected to the master DEPARTMENT table. When the user clicks on an any of
the DEPARTMENT values in the listbox, the current row is set to that row in the
table, and the detail PROJECTS table shows the projects for that Department in
the DBWebGrid. Note also that the AutoPostBack property of the DBWebListBox is
set to true -- this allows the client to submit a request back to the server each
time a DBWebListBox item is clicked.
This demo also demonstrates a new use of DBWebListBox. In D8,
DBWebListBox required that the TableName be the target table for the select
ListBox item, while the LookupTableName be the source table for this ListBox
data. In D9, if you make the TableName and the LookupTableName the same
property, it is possible to simply use it for the purpose of selecting a
particular row. The Row selection code is the WebForms's FormLoad event:
(DBWebDataSource1 as
IDBDataSource).RegisterGoToControl(DBWebListBox1, DBWebListBox1,
'DEPARTMENT');